package com.candy.service.impl;

import com.candy.bean.UserInfo;
import com.candy.dao.UserInfoMapper;
import com.candy.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    UserInfoMapper userInfoMapper;

    @Override
    public int login(UserInfo userInfo) {
        UserInfo userInfo1 = userInfoMapper.login(userInfo);
        if(userInfo1==null){
            return 0;
        }
        else{
           if(userInfo1.getUserRole()==1)
           {
               return 2;
           }
           return 1;
        }
    }
}
